home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17809 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: uu4news.netcom.com!dodge!news
  2. From: Deepak Goel <Deepak.Goel@siemensrolm.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: main()
  5. Date: Wed, 17 Apr 1996 09:17:34 -0700
  6. Organization: Siemens Rolm Communications Inc.
  7. Message-ID: <3175199E.4690@siemensrolm.com>
  8. References: <3174c0dc.7652220@news.flex.com.au>
  9. NNTP-Posting-Host: argonne.eng.sc.rolm.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB1 (WinNT; I)
  14.  
  15. Tony L wrote:
  16. > Hi all,
  17. > I have come across two different ways that 2 different beginners books
  18. > recommend that every program should start.  Could someone please tell
  19. > me which one is the "BEST" or proper way?
  20. > #include <stdio.h>
  21. > void main()
  22. > {
  23. >         printf("Hello!\n");
  24. >         return 0;
  25. > }This one is certainly wrong because void return type means that 
  26. function doesn't return any value and you are (should also).
  27. > Or, the same as above but not include "void":
  28. > #include <stdio.h>
  29. > main()
  30. > {
  31. >         printf("Hello!\n");
  32. >         return 0;
  33. > }This is the right approach but this has an implicit return type 
  34. of 'int'. Instead you should have something like this
  35. int main()
  36. > As I am  just really starting out in "C", I'd like to get off to the
  37. > right way.  :-)
  38. > Thank you very much for your time....
  39. > Regards,
  40. > TonyL....
  41. > cobweb@flex.com.au
  42.